//验证输入是否为空
function check() {
    if (!$("input[name='carNum']").val()) {
        new show_modal({
            modalId: 'alert_like',
            modalCon: '<p style="text-align: center">输入信息为空</p>',
            bootstrapOptionObj: {show: true, backdrop: false},
            callback: timeClose()
        });
        console.log('上面');
        return false;
    }
}
//异步提交表单
function checkUp() {
    console.log(44);
    $.post("admin.php", {act: "queryOrder"}, function (data) {
        if (data) {
            document.write(data);
        } else {

        }
        console.log(55);
        console.log(data);
    });
}


//显示弹窗函数
var show_modal = function (setting) {
    var _self = this;
    //判断为null或者空值
    _self.IsNull = function (value) {
        if (typeof (value) == "function") {
            return false;
        }
        if (value == undefined || value == null || value == "" || value.length == 0) {
            return true;
        }
        return false;
    }
    //默认配置
    _self.DefautlSetting = {
        modalId: '',
        modalCon: '这是提示的信息！',
        bootstrapOptionObj: {show: true},
        callback: function () {
        }
    };
    //读取配置
    _self.Setting = {
        modalId: _self.IsNull(setting.modalId) ? _self.DefautlSetting.modalId : setting.modalId,
        modalCon: _self.IsNull(setting.modalCon) ? _self.DefautlSetting.modalCon : setting.modalCon,
        bootstrapOptionObj: _self.IsNull(setting.bootstrapOptionObj) ? _self.DefautlSetting.bootstrapOptionObj : setting.bootstrapOptionObj,
        callback: _self.IsNull(setting.callback) ? _self.DefautlSetting.callback : setting.callback
    };
    //定义函数操作
    _self.int = function () {
        if (_self.Setting.modalId == '') {
            return;
        }
        $("#modal_message").empty().append(_self.Setting.modalCon);//设置弹窗内容
        $("#" + _self.Setting.modalId).modal(_self.Setting.bootstrapOptionObj);//设置弹窗的bootstrap属性方法
        _self.Setting.callback();
    }
    //执行操作
    _self.int();
}
//show_modal回调函数，4s后隐藏弹窗
function timeClose() {
    setTimeout(function () {
        $('#alert_like').modal('hide');
    }, 3000);
}

function cReturn() {
    window.location.href = go.back(-1);
}
function goDetail() {
    window.location.href = 'http://localhost/chelaile/detail.php';
    // window.location.href ='http://localhost:8080/chelaile/detail.php';
}
//跳转具体页面事件
function goWhichPage(action) {
    switch (action) {
        case 'index':
            $.post("index.php", function (data) {
                document.write(data);
                // document.close();
                console.log(11);
                keyBord()
            });
            break;
        case 'detail':
            $.post("detail.php", function (data) {
                document.write(data);
            });
            break;
    }
}
//键盘输入、删除事件
function keyBord() {
    console.log(22);
    var $write = $('#write'),
        shift = false,
        capslock = true;
    console.log($('#keyboard li').length);
    $('#keyboard li').click(function () {
        console.log(33);
        var $this = $(this),
            character = $this.html(); // If it's a lowercase letter, nothing happens to this variable
        if (shift === true) {
            $('.symbol span').toggle();
            if (capslock === false) $('.letter').toggleClass('uppercase');
            shift = false;
        }
        // Add the character
        $write.val($write.val() + character);
    });
    $('.deletebtnkey').click(function () {
        var html = $write.val();
        $write.val(html.substr(0, html.length - 1));
    });
}

function startCheckParking() {

}

